//
//  PageHomeContoller.swift
//  elarc01
//
//  Created by elarc on 16/4/19.
//  Copyright © 2016年 elarc. All rights reserved.
//

import Foundation

class PageHomeController:UIViewController,PagingMenuControllerDelegate {
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        buildPageControl()
        
    }
    //分页管理器
    
    func buildPageControl(){
        
        let first = SiteUpViewController()
        first.title = "First title"
        let second = SecondTranslasionVC()
        second.title = "second title"
        let third = NewIdealViewController()
        third.title = "third title"
        let forth = NewLittleIdeaViewController()
        forth.title = "forth title"
        let viewControllers = [first, second, third, forth]

//page
//        let options = PagingMenuOptions()
//        options.menuHeight = 50
//        let pagingMenuController = self.childViewControllers.first as! PagingMenuController
//        pagingMenuController.delegate = self
//        pagingMenuController.setup(viewControllers: viewControllers, options: options)
        
//segment
        let options = PagingMenuOptions()
        options.menuItemMargin = 5
        options.menuHeight = 60
        options.menuDisplayMode = .SegmentedControl
        let pagingMenuController = PagingMenuController(viewControllers: viewControllers, options: options)
        pagingMenuController.view.frame.origin.y += 64
        pagingMenuController.view.frame.size.height -= 64
        addChildViewController(pagingMenuController)
        view.addSubview(pagingMenuController.view)
        pagingMenuController.didMoveToParentViewController(self)
        
    }
    func willMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController) {
        
    }
    
    func didMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController) {
        
    }
}